from lxml import etree

f = open('links.xml', 'r')      #open file

root = etree.fromstring(f.read()) #read file and create etree from string

f.close()

children_list = root.getchildren()              #make list of children

for i in children_list:                         #print fancy fancy
        child_list = i.getchildren()
        print i.tag             #Get tag
        print " - PARENT: " + child_list[0].get("name")         # PARENT name
        print " - DH: a=" + child_list[1].get("a") + " d=" + child_list[1].get("d") + " alpha=" + child_list[1].get("alpha") + " theta=" + child_list[1].get("theta")
        print " - GRAPHICS: " + child_list[2].get("parameters")         # PARENT name
